home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 142
/
Gekkan Dennou Club - 2000.3 Vol. 142 (Japan).7z
/
Gekkan Dennou Club - 2000.3 Vol. 142 (Japan) (Track 1).bin
/
tools
/
s_tool
/
recode2.c
< prev
next >
Wrap
Text File
|
1999-06-04
|
14KB
|
668 lines
#include "JX250.H"
#include <sys\iocs.h>
#include <sys\dos.h>
#include <sys\scsi.h>
#include <stdio.h>
#include <stdlib.h>
extern UNchar BaiStr[][8];
UNchar RSE[6][8]={
"CUT","PIC","GLM",
"BMP","JPG","RGB"
};
/************************************************************
上 ボタンチェック
[out] r= 0; 正常終了
1; キャンセル終了
99; 終了
*************************************************************/
int Rec_click_botton1( ty,xx,yy )
int ty,xx,yy;
{
int j,r;
UNchar buf[256];
UNchar *s;
void rcb1_sub1(),rcb1_sub2(),rcb1_sub3(),rcb1_sub4(),rcb1_sub5(),rcb1_sub6(),rcb1_sub7();
r=0;
switch( ty ){
case('5'):
//------------- セーブ
if ( sxbotton(19*16,6*16,22*16+15,7*16+15,1)==0 ){
Rec_PosDedraw();
r=SaveGraphic();
Rec_PosSetDraw(RecX1,RecY1,RecX2,RecY2);
}
break;
case('6'):
//------------- ロード
if ( sxbotton(24*16,6*16,27*16+15,7*16+15,1)==0 ){
Rec_PosDedraw();
r=LoadGraphic();
Rec_PosSetDraw(RecX1,RecY1,RecX2,RecY2);
}
break;
case('G'):
//------------ ファイル名
r=Rec_click_name(xx);
break;
case('b'):
//------------- 原点X
r++;
case('a'):
r++;
case('1'):
if ( ScanData==0 ) // 「画像」のポインタ
break;
if ( ty=='1' ) xx=19*16;
r=rcb1_sizesub1(r,xx,yy,RecX1,0,RecX2,rcb1_sub1);
if ( r==0 && ty=='1' )
r=Rec_click_botton1( '2',xx+80,yy );
break;
case('d'):
//------------- 原点Y
r++;
case('c'):
r++;
case('2'):
if ( ScanData==0 ) // 「画像」のポインタ
break;
if ( ty=='2' ) xx=24*16;
r=rcb1_sizesub1(r,xx,yy,RecY1,0,RecY2,rcb1_sub2);
if ( r==0 && ty=='2' )
r=Rec_click_botton1( '3',xx-80,yy+32 );
break;
case('f'):
//------------- 幅
r++;
case('e'):
r++;
case('3'):
if ( ScanData==0 ) // 「画像」のポインタ
break;
if ( ty=='3' ) xx=19*16;
r=rcb1_sizesub1(r,xx,yy,RecX2-RecX1,1,ScanDataX-RecX1,rcb1_sub3);
if ( r==0 && ty=='3' )
r=Rec_click_botton1( '4',xx+80,yy );
break;
case('h'):
//------------- 高さ
r++;
case('g'):
r++;
case('4'):
if ( ScanData==0 ) // 「画像」のポインタ
break;
if ( ty=='4' ) xx=24*16;
r=rcb1_sizesub1(r,xx,yy,RecY2-RecY1,1,ScanDataY-RecY1,rcb1_sub4);
break;
case('7'):
//------------- 戻る
if ( sxbotton(29*16+1,6*16+1,29*16+32-2,6*16+32-2,1)==0 )
r=99;
break;
case('j'):
//------------- ドライブ
r++;
case('i'):
r++;
r=rcb1_sizesub1(r,xx,yy,Drive,1,26+1,rcb1_sub5);
break;
case('y'):
//------------- ソート
r++;
case('x'):
r++;
r=rcb1_sizesub1(r,xx,yy,FilerSortMode,0,4,rcb1_sub6);
break;
case('Z'):
//------------- JPEG セーブの設定
if ( xx<27*16+1 || xx>29*16-2 || yy<10*16 || yy>10*16+12 )
return(1);
if ( sxbotton(27*16+1,10*16,29*16-2,10*16+12,1)!=0 )
return(1);
Rec_PosDedraw();
j=DataC;
if ( ScanData==0 )
j=FullColor;
if ( j==0 && JpegedUseMode==0 ){ // 0;64k の時使用する 1;使用しない
Dialog("jpeged.r(ENCODE)のスイッ","チを設定して下さい",0,0);
s=InputStr(3*16,15*16,JpegSwc,24,0,0);
if ( s[0]==0 && s[1]==255 ){
r=1;
} else {
strcpy(JpegSwc,s);
r=0;
}
Dialog(0,0,0,-1);
} else {
Dialog("ej.x(ENCODE)のスイッチを","設定して下さい",0,0);
s=InputStr(3*16,15*16,Jpeg24Swc,24,0,0);
if ( s[0]==0 && s[1]==255 ){
r=1;
} else {
strcpy(Jpeg24Swc,s);
r=0;
}
Dialog(0,0,0,-1);
Dialog("ej.x/dj.x の テンポラリパス","設定して下さい(省略可)",0,0);
s=InputStr(3*16,15*16,RGBtemp,24,0,0);
if ( s[0]==0 && s[1]==255 ){
r=1;
} else {
strcpy(RGBtemp,s);
r=0;
}
Dialog(0,0,0,-1);
}
Rec_PosSetDraw(RecX1,RecY1,RecX2,RecY2);
break;
default:
if ( ty>='A' && ty<='F' ){
RecSavMode=ty-'A';
Rec_SaveModeDraw();
if ( Afile[0]!=0 ){
jstrcpy(buf,Afile);
strmfe(Afile,buf,RSE[RecSavMode]);
}
FileSearch(0);
ViewFiles(-1);
ViewFiles(ViewFileY);
}
}
return(r);
}
/*************************************
(上)上部サブルーチン
*************************************/
int rcb1_sizesub1(ty,xx,yy,ii,ll,hh,sub)
int ty,xx,yy,ii,hh,ll;
void (*sub)();
{
int i,r;
UNchar *M;
UNchar buf[128];
if ( ty==0 ){
sprintf(buf,"%d",ii); //sprintf(buf,"%5d",i);
M=InputStr((xx&0xFFF0)+2,(yy&0xFFF0)+2,buf,5,0,1);
if ( M[0]==0 && M[1]==0xFF ){
Rec_PosSetDraw(-1,-1,-1,-1,-1);
r=1;
} else {
i=atoi(M);
if ( i<ll || i>=hh ){
Rec_PosSetDraw(-1,-1,-1,-1,-1);
r=1;
} else {
(*sub)(i);
r=0;
}
}
} else {
r=kazu_move(((ty==1)?xx:xx-16)&0xFFF0,yy&0xFFF0,0,ii,ll,hh-1,sub);
}
return(r);
}
/*+++++++++++++++++++++++++++++++*/
void rcb1_sub1(int l)
{
int i;
i=RecX2+(l-RecX1);
if ( i>=ScanDataX )
i=ScanDataX;
Rec_PosSetDraw(l,RecY1,i,RecY2);
}
/*++++++++++*/
void rcb1_sub2(int l)
{
int i;
i=RecY2+(l-RecY1);
if ( i>=ScanDataY )
i=ScanDataY;
Rec_PosSetDraw(RecX1,l,RecX2,i);
}
/*++++++++++*/
void rcb1_sub3(int l)
{
Rec_PosSetDraw(RecX1,RecY1,RecX1+l,RecY2);
}
/*++++++++++*/
void rcb1_sub4(int l)
{
Rec_PosSetDraw(RecX1,RecY1,RecX2,RecY1+l);
}
/*++++++++++*/
void rcb1_sub5(int l)
{
int o;
o=Drive;
ChDrvDir(Apath);
Drive= l;
GetDrvDir(l,Apath);
FileSearch(0);
Drive= l;
ViewFiles(-1);
ViewFiles(ViewFileY);
}
/*++++++++++*/
void rcb1_sub6(int l)
{
FilerSortMode=l;
Rec_SortModeDraw();
FileSearch(0);
ViewFiles(-1);
ViewFiles(ViewFileY);
}
/************************************************************
倍率ボタンチェック
[out] r= 0; 正常終了
1; キャンセル終了
99; 終了
*************************************************************/
int Rec_click_botton4( xx )
int xx;
{
int r;
void rcb4_sub();
r=kazu_move(13*16,0,0,RecVwBai,-3,2,rcb4_sub); // x4 までにしておこう
return(r);
}
/*++++++++++*/
void rcb4_sub(int l)
{
int i;
RecVwBai=l;
if ( l>=0 ){
i=1<<RecVwBai;
if ( RecPX>(ScanDataX-(256/i)) )
RecPX=ScanDataX-(256/i);
if ( RecPY>(ScanDataY-(480/i)) )
RecPY=ScanDataY-(480/i);
} else {
i=1<<(-RecVwBai);
if ( RecPX>(ScanDataX-(256*i)) )
RecPX=ScanDataX-(256*i);
if ( RecPY>(ScanDataY-(480*i)) )
RecPY=ScanDataY-(480*i);
}
if ( RecPX<0 )
RecPX=0;
if ( RecPY<0 )
RecPY=0;
Rec_PosDedraw();
ScanGraphView(RecPX,RecPY,0);
Rec_PosSetDraw(RecX1,RecY1,RecX2,RecY2);
p_12_sprintf(11*16+2+6,2,BaiStr[ RecVwBai+4 ]);
}
/************************************************************
縦バー(ボタン)
[out] r= 0; 正常終了
1; キャンセル終了
99; 終了
*************************************************************/
int Rec_click_botton6( yy,bt )
int yy,bt;
{
int i,j,r,yo,sy,b,y,bi,py;
void rcb6_sub1();
if ( bt==0 ){
j=( yy==1 )?1:2;
if ( RecVwBai>=0 ){
i=1<<RecVwBai;
r=kazu_move(0,yy*16,j,RecPY/8,0,(ScanDataY/8-(480/8/i))+1,rcb6_sub1);
} else {
i=1<<(-RecVwBai);
r=kazu_move(0,yy*16,j,RecPY/8,0,(ScanDataY/8-(480/8*i))+1,rcb6_sub1);
}
} else {
if ( RecVwBai>=0 ){
bi=1<<RecVwBai;
j=RecPY *(30*16-32)/ScanDataY +32 ;
i=480/bi *(30*16-32)/ScanDataY +j;
} else {
bi=1<<(-RecVwBai);
j=RecPY *(30*16-32)/ScanDataY +32 ;
i=480*bi *(30*16-32)/ScanDataY +j;
}
if ( yy<j || yy>i )
return(0);
yo=-1;
sy=yy;
py=RecPY;
while( MS_LSW()!=0 && (b=MS_RSW())==0 ){
yy=( i=_ms_curgt_() )&0xFFFF;
if ( yo==yy )
continue;
yo=yy;
y=(yy-sy)*ScanDataY/(30*16-32);
j=py+y;
if ( RecVwBai>=0 ){
if ( j>=(ScanDataY-(480/bi)) )
j=(ScanDataY-(480/bi))-1 +1;
} else {
if ( j>=(ScanDataY-(480*bi)) )
j=(ScanDataY-(480*bi))-1 +1;
}
if ( j<0 )
j=0;
if ( RecPY!=j ){
RecPY=j;
Rec_PosDedraw();
ScanGraphView(RecPX,RecPY,0);
Rec_PosSetDraw(RecX1,RecY1,RecX2,RecY2);
CRTVDISP();
}
}
r=0;
}
return(r);
}
/*++++++++++*/
void rcb6_sub1(int l)
{
int i;
PosDedraw();
RecPY=l*8;
if ( RecVwBai>=0 ){
i=1<<RecVwBai;
if ( RecPY>=(ScanDataY-(480/i)) )
RecPY=(ScanDataY-(480/i))-1 +1;
if ( RecPY<0 )
RecPY=0;
} else {
i=1<<(-RecVwBai);
if ( RecPY>=(ScanDataY-(480*i)) )
RecPY=(ScanDataY-(480*i))-1 +1;
if ( RecPY<0 )
RecPY=0;
}
ScanGraphView(RecPX,RecPY,0);
Rec_PosSetDraw(RecX1,RecY1,RecX2,RecY2);
}
/************************************************************
横バーボタン
[out] r= 0; 正常終了
1; キャンセル終了
99; 終了
*************************************************************/
int Rec_click_botton7( xx,bt )
int xx,bt;
{
int i,j,r,xo,sx,b,x,bi,yy,px;
void rcb7_sub1();
if ( bt==0 ){
j=( xx==1 )?1:2;
if ( RecVwBai>=0 ){
i=1<<RecVwBai;
r=kazu_move(xx*16,31*16,j,RecPX/8,0,(ScanDataX/8-(256/8/i))+1,rcb7_sub1);
} else {
i=1<<(-RecVwBai);
r=kazu_move(xx*16,31*16,j,RecPX/8,0,(ScanDataX/8-(256/8*i))+1,rcb7_sub1);
}
} else {
if ( RecVwBai>=0 ){
bi=1<<RecVwBai;
j=RecPX *(15*16-32)/ScanDataX +32 ;
i=256/bi *(15*16-32)/ScanDataX +j;
} else {
bi=1<<(-RecVwBai);
j=RecPX *(15*16-32)/ScanDataX +32 ;
i=256*bi *(15*16-32)/ScanDataX +j;
}
if ( xx<j || xx>i )
return(0);
xo=-1;
sx=xx;
px=RecPX;
while( MS_LSW()!=0 && (b=MS_RSW())==0 ){
yy=( i=_ms_curgt_() )&0xFFFF;
xx=i>>16;
if ( xo==xx )
continue;
xo=xx;
x=(xx-sx)*ScanDataX/(15*16-32);
j=px+x;
if ( RecVwBai>=0 ){
if ( j>=(ScanDataX-(256/bi)) )
j=(ScanDataX-(256/bi))-1 +1;
} else {
if ( j>=(ScanDataX-(256*bi)) )
j=(ScanDataX-(256*bi))-1 +1;
}
if ( j<0 )
j=0;
if ( RecPX!=j ){
RecPX=j;
Rec_PosDedraw();
ScanGraphView(RecPX,RecPY,0);
Rec_PosSetDraw(RecX1,RecY1,RecX2,RecY2);
CRTVDISP();
}
}
r=0;
}
return(r);
}
/*++++++++++*/
void rcb7_sub1(int l)
{
int i;
PosDedraw();
RecPX=l*8;
if ( RecVwBai>=0 ){
i=1<<RecVwBai;
if ( RecPX>=(ScanDataX-(256/i)) )
RecPX=(ScanDataX-(256/i))-1 +1;
if ( RecPX<0 )
RecPX=0;
} else {
i=1<<(-RecVwBai);
if ( RecPX>=(ScanDataX-(256*i)) )
RecPX=(ScanDataX-(256*i))-1 +1;
if ( RecPX<0 )
RecPX=0;
}
ScanGraphView(RecPX,RecPY,0);
Rec_PosSetDraw(RecX1,RecY1,RecX2,RecY2);
}
/************************************************************
縦横バー
[out] r= 0; 正常終了
1; キャンセル終了
99; 終了
*************************************************************/
int Rec_click_bar( xx,yy )
int xx,yy;
{
int i,j,r,xo,yo,sx,sy,x,y,bi,px,py;
xo=-1;
yo=-1;
sx=xx;
sy=yy;
px=RecPX;
py=RecPY;
if ( RecVwBai>=0 ){
bi=1<<RecVwBai;
} else {
bi=1<<(-RecVwBai);
}
MsPat(7);
while( MS_RSW()!=0 ){
_dos_keysns();
_dos_change_pr();
yy=( i=_ms_curgt_() )&0xFFFF;
xx=i>>16;
if ( xo==xx && yo==yy )
continue;
xo=xx;
yo=yy;
if ( RecVwBai>=0 ){
x=(xx-sx)/bi;
y=(yy-sy)/bi;
} else {
x=(xx-sx)*bi;
y=(yy-sy)*bi;
}
i=px-x;
if ( RecVwBai>=0 ){
if ( i>=(ScanDataX-(256/bi)) )
i=(ScanDataX-(256/bi))-1 +1;
} else {
if ( i>=(ScanDataX-(256*bi)) )
i=(ScanDataX-(256*bi))-1 +1;
}
if ( i<0 )
i=0;
j=py-y;
if ( RecVwBai>=0 ){
if ( j>=(ScanDataY-(480/bi)) )
j=(ScanDataY-(480/bi))-1 +1;
} else {
if ( j>=(ScanDataY-(480*bi)) )
j=(ScanDataY-(480*bi))-1 +1;
}
if ( j<0 )
j=0;
if ( RecPX!=i || RecPY!=j ){
RecPX=i;
RecPY=j;
Rec_PosDedraw();
ScanGraphView(RecPX,RecPY,0);
Rec_PosSetDraw(RecX1,RecY1,RecX2,RecY2);
CRTVDISP();
}
}
MsPat(0);
r=0;
return(r);
}
/************************************************************
FILES
[out] r= 0; 正常終了
1; キャンセル終了
99; 終了
*************************************************************/
int Rec_click_files( yy )
int yy;
{
int y;
UNchar buf[256];
y=ViewFileY+yy;
if ( DDS_max<0 )
return(1);
if ( y>=DDS_max )
return(1);
if ( (DDS[y].atr&bit(4))!=0 ){
// ディレクトリだ
jstrcpyfnm(buf,DDS[y].fname,DDS[y].fext);
_dos_chdir( buf );
GetDrvDir(0,Apath);
FileSearch(0);
ViewFiles(-1);
ViewFiles(ViewFileY);
} else {
jstrcpyfnm(Afile,DDS[y].fname,DDS[y].fext);
ViewFiles(-1);
//ViewFiles(ViewFileY);
}
return(0);
}
/************************************************************
なまえ
[out] r= 0; 正常終了
1; キャンセル終了
99; 終了
*************************************************************/
int Rec_click_name(xx)
int xx;
{
int r;
UNchar dummy[128];
UNchar name[128];
UNchar *M;
M=InputStr(19*16+2,11*16+2,Afile,26,0,0);
if ( M[0]==0 && M[1]==0xFF ){
ViewFiles(-1);
r=1;
} else {
strsfn(M,dummy,dummy,name,dummy);
strmfe(Afile,name,RSE[RecSavMode]);
ViewFiles(-1);
r=0;
}
return(r);
}
/************************************************************
files スクロール
[out] r= 0; 正常終了
1; キャンセル終了
99; 終了
*************************************************************/
int Rec_click_roll( yy )
int yy;
{
int i,m,y,o;
m=DDS_max-16;
//if ( yy==8 )
// return(0);
y=yy/4;
i=0;
if ( sxbotton(30*16,i+14*16+y*(16*4),30*16+15,i+14*16+y*(16*4)+16*4-1,1)!=0 ){
// Cansel
return(1);
}
if ( m<=0 )
return(0);
o=ViewFileY;
if ( y<=1 ){
// 上
if ( y==0 )
ViewFileY-=8;
else ViewFileY--;
if ( ViewFileY<0 )
ViewFileY=0;
} else {
// 下
if ( y==3 )
ViewFileY+=8;
else ViewFileY++;
if ( ViewFileY>m )
ViewFileY=m;
}
if ( o!=ViewFileY )
ViewFiles(ViewFileY);
return(0);
}
/************************************************************
[DEL]ボタン
[out] r= 0; 正常終
1; キャンセル終了
99; 終了
*************************************************************/
int Rec_click_del()
{
int f;
if ( sxbotton(27*16,30*16,29*16,31*16-1,-1)!=0 )
return(1);
if ( Afile[0]==0 ){
Dialog(0,"ファイル名を指定して下さい",0,1);
return(1);
}
f=_dos_open(Afile,0);
if ( f<0 ){
Dialog(0,"指定ファイルは","存在していません",1);
return(1);
}
// ファイルが open できた
_dos_close(f);
if ( Dialog(0,"指定ファイルを消去して","よろしいですか?",2)!=0 )
return(1);
_dos_delete(Afile);
FileSearch(0);
ViewFiles(-1);
ViewFiles(ViewFileY);
return(0);
}